/**
 * @author monirul
 */

var UserHistoryModel =  new Class.create({
	
	initialize: function(){
		this._userHistoryList = {};
	},
	
	init:function(o){
		if(o['userHistoryList'] != null){
			this._userHistoryList = o['userHistoryList'];
		}
		this.userHistoryUpdated = new Event(this);
	},
	
	showUserHistory: function(userHistoryList) {
		this._userHistoryList = userHistoryList;
		this.userHistoryUpdated.notify({'userHistoryList': this._userHistoryList});
	},
	
	getUserHistory:function(){
		return this._userHistoryList;
	},
	
	getUserGameHistory:function(historyId){
		for(var i=0;i<this._userHistoryList.length; i++){
			if(this._userHistoryList[i].userHistoryId == historyId){
				return this._userHistoryList[i].userGameHistoryList; 
			}
		}
		return null;
		
	}
	
	
	
});
